<%@ page import="databeans.*"%>
<%@ page import="helper.*"%>
<%@ page import="java.util.*" %>
<%@ page import="java.text.SimpleDateFormat" %>

<jsp:include page="../common/header.jsp" />

<title>Carnegie Financial Services - Research Funds</title>
<script type="text/javascript" src="view/js/visualize.jQuery.js"></script>
<link type="text/css" href="view/css/visualize.jQuery.css" rel="stylesheet" />
<%
	if(request.getAttribute("research_type")!=null){
		int mod = (Integer)request.getAttribute("research_type");
		if(mod == 1)
		{
%>
<script type="text/javascript">
	$(document).ready(function() { 
		//$('#fund-history').colorize({ hoverColor:'none', ignoreHeaders :true, hiliteColor :'none' });
		$('.fund_graph').visualize({type: 'bar', parseDirection:'x',appendKey:true,  height: 250,width:400,barGroupMargin:8,barMargin:2, colors:['#ee8310','#be1e2d','#8CCE3B','#92d5ea']});
		
	});
</script>
<%}else { %>
<script type="text/javascript">
	$(document).ready(function() { 
		//$('#fund-history').colorize({ hoverColor:'none', ignoreHeaders :true, hiliteColor :'none' });
		$('.fund_graph').visualize({type: 'bar', parseDirection:'x',appendKey:true,  height: 250,width:700,barGroupMargin:1,barMargin:4, colors:['#ee8310','#be1e2d','#8CCE3B','#92d5ea']});
		
	});
</script>
<%}} %>
</head>

<body>
	<div id="container">
    	<div id="header">
        	<h2>Carnegie Financial Services</h2>
    		<jsp:include page="../common/top-menu.jsp" />
      </div>
        <div id="wrapper">
            <div id="content">
            	<div id="box" style="height:400px;">
	            	
	            	<jsp:include page="../common/messages.jsp"/>
	            	<% 
	            		SimpleDateFormat format = new SimpleDateFormat("EEE M/d");
					  	if((request.getAttribute("fundHistoryList")==null)&&(request.getAttribute("fundHistory")==null))
					  	{
					  %>
					  <p class="pad-left-20">There is no history of this Fund. </p>
					 <% 
					 	}else{
					 %>
					 <h3><%= (String)request.getAttribute("fundName") %> History</h3>
           		<%if(request.getAttribute("fundHistoryList")!=null)
					{
						FundHistory[] fh = (FundHistory[]) request.getAttribute("fundHistoryList");
						int mod = (Integer)request.getAttribute("research_type");
				%>
                		<table class="fund_graph">
                			<thead>
                				<tr>
                					<td></td>
                				<%
									for(int i =0 ; i< fh.length ; i++)
									{
										if(i%mod == 0){
								%>
								 	<th><%=format.format(fh[i].getPriceDate()) %></th>
							  	<%
							  			} 
									}%>
							  	</tr>
							</thead>
							<tbody>
								
   								 <tr>
   								 <th><%=(String)request.getAttribute("fundName") %></th>
   								 <%
									for(int i =0 ; i< fh.length ; i++)
									{
										if(i%mod == 0){
								%>
      									<td><%= Double.parseDouble(helper.Formatter.prepCashToView(fh[i].getPrice())) %></td>
      							<%		} 
      								}%>
								</tr>
								<% 
							}
							%>
							</tbody>
						</table>
                	<!-- 
                	<div class="navigation_pages">
						<a href="#">Next</a>
						<a href="#">Last</a>
					</div>
					 -->
                	<% } %>
                	<div class="padding" style="height:25px"></div>
                	<form id="form" action="customerResearchFund.do" method="post">
                		<input id="button1" name="back" type="submit" value="Go Back" tabindex="1" />
                	</form>
	            </div>
            </div>
            
            <jsp:include page="../common/sidebar.jsp" />
      </div>
        <jsp:include page="../common/footer.jsp" />
</div>
</body>
</html>

